<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:t="http//myfaces.apache.org/tomahawk">
<head>
<title>Find x in system of equations in max-min algebra</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

</head>
<body>

<f:view>
	<h:outputText
		value="MAX-MIN algebra EXAMPLE. Fill matrixes A and B or use random generator to fill these. Find vektor x during the equation. Max generated number is now set to #{backingBean.maxNumber}." />

	<h:form id="form">
		<h:messages />
		<h:panelGrid id="grid" columns="2" style="margin-top: 10px;">
			<h:outputText id="maxNumber"
				value="Set maximum of random number here:" />
			<h:inputText id="inputMaxNumber" value="#{backingBean.maxNumber}"
				required="true">
				<f:convertNumber type="number" maxIntegerDigits="3"/>
			</h:inputText>	
			<h:commandButton id="btRandom" value="Random to A and B matrix"
				actionListener="#{backingBean.randomAB}" />
			<h:message id="message2" for="inputMaxNumber" />
		</h:panelGrid>
	</h:form>
	<h:form id="form2">
		<h:panelGrid id="matice" columns="3"
			style="margin-top: 10px; width: 600px;">
			<h:outputText value="Matrix A" />
			<h:outputText value="Matrix B" />
			<h:outputText value="Vector x" />
			<h:panelGrid id="radkyAmatice" columns="3"
				style="margin-top: 10px; width: 200px;">
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixA.rows[1].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[1].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[1].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixA.rows[2].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[2].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[2].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixA.rows[3].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[3].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[3].cols[2].value}"
					style="width: 5ex;" />
			</h:panelGrid>
			<h:panelGrid id="radkyBmatice" columns="3"
				style="margin-top: 10px; width: 200px; margin-left: 10px;">
				<h:inputText value="#{backingBean.matrixB.rows[0].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[0].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[0].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixB.rows[1].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[1].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[1].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixB.rows[2].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[2].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[2].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixB.rows[3].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[3].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixB.rows[3].cols[2].value}"
					style="width: 5ex;" />
			</h:panelGrid>
			<h:panelGrid id="radkyXmatice" columns="1"
				style="margin-top: 10px; width: 200px; margin-left: 20px;">
				<h:inputText value="#{backingBean.x1.rows[0].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.x1.rows[1].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.x1.rows[2].cols[0].value}"
					style="width: 5ex;" />
			</h:panelGrid>
		</h:panelGrid>
			<h:panelGrid id="gridProHledani" columns="1" style="margin-top: 10px;">
		<h:outputText value="A * x = B * x &nbsp;" style="font-size: x-large" />
		<h:outputText
			value="Question 1: Find vector x. To autofind vector X use this button." />
<h:commandButton id="btFindX" value="Find vector X."
				actionListener="#{backingBean.findX}" />
			
	</h:panelGrid>
		
	</h:form>



	<h:outputText value="Multiplication A with x" style="font-size: x-large" />
	<h:form id="formMultiAwithX">
	<h:panelGrid id="grid" columns="3" style="margin-top: 10px;">
	<h:outputText value="A" style="font-size: x-large" />
	<h:outputText value="x" style="font-size: x-large" />
	<h:outputText value="b1" style="font-size: x-large" />
		<h:panelGrid id="radkyAmatice2" columns="3"
				style="margin-top: 10px; width: 200px;">
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[0].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixA.rows[1].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[1].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[1].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixA.rows[2].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[2].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[2].cols[2].value}"
					style="width: 5ex;" />

				<h:inputText value="#{backingBean.matrixA.rows[3].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[3].cols[1].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.matrixA.rows[3].cols[2].value}"
					style="width: 5ex;" />
			</h:panelGrid>
			<h:panelGrid id="radkyB1matice" columns="1"
				style="margin-top: 10px; width: 200px; margin-left: 20px;">
				<h:inputText value="#{backingBean.b1.rows[0].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.b1.rows[1].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.b1.rows[2].cols[0].value}"
					style="width: 5ex;" />
				<h:inputText value="#{backingBean.b1.rows[3].cols[0].value}"
					style="width: 5ex;" />
			</h:panelGrid>
	</h:panelGrid>
				<h:commandButton id="btMultiAX" value="Multiplication A with vector X."
				actionListener="#{backingBean.multiAX}" />
				<h:commandButton id="btVynulujAX" value="Clear values."
				actionListener="#{backingBean.clearAX}" />
	</h:form>
</f:view>
</body>
</html>
